<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Rozproszony_system_koordynacji_agentow_mobilnych: Plik źródłowy GnuplotInc.cpp</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Wygenerowano przez Doxygen 1.7.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul class="tablist">
      <li><a href="main.html"><span>Strona&nbsp;główna</span></a></li>
      <li><a href="annotated.html"><span>Struktury&nbsp;Danych</span></a></li>
      <li class="current"><a href="files.html"><span>Pliki</span></a></li>
      <li><a href="dirs.html"><span>Katalogi</span></a></li>
    </ul>
  </div>
  <div class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>Lista&nbsp;plików</span></a></li>
      <li><a href="globals.html"><span>Globalne</span></a></li>
    </ul>
  </div>
  <div class="navpath">
    <ul>
      <li><a class="el" href="dir_ea6d7edaf73c9bd1c81d51f5bfe68d38.html">src</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<h1>GnuplotInc.cpp</h1>  </div>
</div>
<div class="contents">
<a href="GnuplotInc_8cpp.html">Idź do dokumentacji tego pliku.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;fstream&gt;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;cstdlib&gt;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include &lt;stdlib.h&gt;</span>
<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;cstring&gt;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &quot;<a class="code" href="GnuplotInc_8hh.html" title="Zawiera funkcje uzywane do rysowania wykresow uzywajac Gnuplot&amp;#39;a.">GnuplotInc.hh</a>&quot;</span>
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="keyword">using namespace </span>std;
<a name="l00022"></a>00022 
<a name="l00036"></a><a class="code" href="GnuplotInc_8cpp.html#a07bd2e7a5945dc93fe3114d62e8040f7">00036</a> <span class="keywordtype">void</span> <a class="code" href="GnuplotInc_8cpp.html#a07bd2e7a5945dc93fe3114d62e8040f7" title="Procedura zapisuje wyrysowany wykres do pliku o podanym rozszerzeniu.">SavePlot</a>(ofstream &amp;Strm,<span class="keywordtype">char</span>* PlotName,<a class="code" href="GnuplotInc_8hh.html#a2c794c5c13ab4dd7e65bad031dbe41c3">FileType</a> ext,<span class="keywordtype">int</span> winid)
<a name="l00037"></a>00037 {
<a name="l00038"></a>00038         <span class="keywordflow">switch</span>(ext){
<a name="l00039"></a>00039         <span class="keywordflow">case</span> <a class="code" href="GnuplotInc_8hh.html#a2c794c5c13ab4dd7e65bad031dbe41c3ab7e4e0120a041dbe6528b050c04269e0" title="brak pliku wyjsciowego">none</a>:
<a name="l00040"></a>00040                 <span class="keywordflow">break</span>;
<a name="l00041"></a>00041         <span class="keywordflow">case</span> <a class="code" href="GnuplotInc_8hh.html#a2c794c5c13ab4dd7e65bad031dbe41c3a40aed305ff38af63ddac586aff968d3b" title="plik .eps">eps</a>:
<a name="l00042"></a>00042                 Strm&lt;&lt;<span class="stringliteral">&quot;set terminal postscript eps enhanced color&quot;</span>&lt;&lt;endl;
<a name="l00043"></a>00043                 Strm&lt;&lt;<span class="stringliteral">&quot;set output &#39;&quot;</span>&lt;&lt;<a class="code" href="Agent_8hh.html#a4905f5e9a8eeb48ce583354c1d0c7a9f" title="komunikacji z Gnuplotem">PLOTDIR</a>&lt;&lt;PlotName&lt;&lt;winid&lt;&lt;<span class="stringliteral">&quot;.eps&#39;&quot;</span>&lt;&lt;endl;
<a name="l00044"></a>00044                 Strm&lt;&lt;<span class="stringliteral">&quot;replot&quot;</span>&lt;&lt;endl;
<a name="l00045"></a>00045                 <span class="keywordflow">break</span>;
<a name="l00046"></a>00046         <span class="keywordflow">case</span> <a class="code" href="GnuplotInc_8hh.html#a2c794c5c13ab4dd7e65bad031dbe41c3ae4ca64fdd73f453d7d68c28445f7accd" title="plik .png">png</a>:
<a name="l00047"></a>00047                 Strm&lt;&lt;<span class="stringliteral">&quot;set terminal png&quot;</span>&lt;&lt;endl;
<a name="l00048"></a>00048                 Strm&lt;&lt;<span class="stringliteral">&quot;set output &#39;&quot;</span>&lt;&lt;<a class="code" href="Agent_8hh.html#a4905f5e9a8eeb48ce583354c1d0c7a9f" title="komunikacji z Gnuplotem">PLOTDIR</a>&lt;&lt;PlotName&lt;&lt;winid&lt;&lt;<span class="stringliteral">&quot;.png&#39;&quot;</span>&lt;&lt;endl;
<a name="l00049"></a>00049                 Strm&lt;&lt;<span class="stringliteral">&quot;replot&quot;</span>&lt;&lt;endl;
<a name="l00050"></a>00050                 <span class="keywordflow">break</span>;
<a name="l00051"></a>00051 
<a name="l00052"></a>00052 
<a name="l00053"></a>00053 
<a name="l00054"></a>00054 
<a name="l00055"></a>00055         }
<a name="l00056"></a>00056 
<a name="l00057"></a>00057         Strm&lt;&lt;<span class="stringliteral">&quot;set term x11 &quot;</span>&lt;&lt;winid&lt;&lt;endl;
<a name="l00058"></a>00058         Strm&lt;&lt;<span class="stringliteral">&quot;unset output &quot;</span>&lt;&lt;endl&lt;&lt;endl;
<a name="l00059"></a>00059 
<a name="l00060"></a>00060 
<a name="l00061"></a>00061 }
<a name="l00062"></a>00062 
<a name="l00072"></a><a class="code" href="GnuplotInc_8hh.html#a195d5d014ba88fb8b178c0b86ee38271">00072</a> <span class="keywordtype">void</span> <a class="code" href="GnuplotInc_8cpp.html#a8addad24447bf769d41c3ab2f5c8519e" title="Procedura uruchamiajaca serwer, ktory dane z potoku przekazuje do Gnuplota.">GnuplotInit</a>()
<a name="l00073"></a>00073 {
<a name="l00074"></a>00074         system(<span class="stringliteral">&quot;rm GNUPLOT&quot;</span>);
<a name="l00075"></a>00075         system(<span class="stringliteral">&quot;./FIFOserv | gnuplot &amp;&quot;</span>);
<a name="l00076"></a>00076 
<a name="l00077"></a>00077 }
<a name="l00078"></a>00078 
<a name="l00079"></a><a class="code" href="GnuplotInc_8hh.html#a7b8a067f6d6901db018a84a57edb02d3">00079</a> <span class="keywordtype">void</span> <a class="code" href="GnuplotInc_8cpp.html#a7b8a067f6d6901db018a84a57edb02d3">GnuplotSceneClean</a>()
<a name="l00080"></a>00080 {
<a name="l00081"></a>00081         ofstream Strm;
<a name="l00082"></a>00082         Strm.open(<span class="stringliteral">&quot;../plots/todel.dat&quot;</span>);
<a name="l00083"></a>00083         Strm.close();
<a name="l00084"></a>00084         system(<span class="stringliteral">&quot;rm ../plots/*.dat&quot;</span>);
<a name="l00085"></a>00085 }
<a name="l00086"></a>00086 
<a name="l00096"></a><a class="code" href="GnuplotInc_8hh.html#a49d8b3efac536a41a3b8fc68f9f38712">00096</a> <span class="keywordtype">int</span> <a class="code" href="GnuplotInc_8cpp.html#a85e9d774c13b546806a0350beda1c055" title="Procedura konczaca dzialanie serwera FIFO.">GnuplotShutDown</a>()
<a name="l00097"></a>00097 {
<a name="l00098"></a>00098         ofstream Strm;
<a name="l00099"></a>00099         Strm.open(<a class="code" href="GnuplotInc_8hh.html#a3ec677682fff5b0d42b967a6f62a4f90">FIFO_FILE</a>);
<a name="l00100"></a>00100         <span class="keywordflow">if</span>(!Strm.is_open())
<a name="l00101"></a>00101         {
<a name="l00102"></a>00102                 cerr&lt;&lt;<span class="stringliteral">&quot;Nie mozna otworzyc potoku&quot;</span>&lt;&lt;endl;
<a name="l00103"></a>00103                 <span class="keywordflow">return</span> 1;
<a name="l00104"></a>00104         }
<a name="l00105"></a>00105         Strm&lt;&lt;<span class="stringliteral">&quot;q&quot;</span>&lt;&lt;endl&lt;&lt;endl;<span class="comment">//zamkniecie Gnuplot</span>
<a name="l00106"></a>00106         Strm.close();
<a name="l00107"></a>00107         <span class="keywordflow">return</span> 0;
<a name="l00108"></a>00108 }
<a name="l00109"></a>00109 
<a name="l00110"></a>00110 
<a name="l00111"></a><a class="code" href="GnuplotInc_8hh.html#a23f4194eff7b71282f0d0278fd0834e5">00111</a> <span class="keywordtype">int</span> <a class="code" href="GnuplotInc_8cpp.html#a23f4194eff7b71282f0d0278fd0834e5">PlotScene</a>(<span class="keywordtype">double</span> SquareLength,<span class="keywordtype">int</span> SceneSize,<span class="keywordtype">int</span> AgentID)
<a name="l00112"></a>00112 {
<a name="l00113"></a>00113         ofstream Strm;
<a name="l00114"></a>00114 
<a name="l00115"></a>00115         Strm.open(<a class="code" href="GnuplotInc_8hh.html#a3ec677682fff5b0d42b967a6f62a4f90">FIFO_FILE</a>);
<a name="l00116"></a>00116         <span class="keywordflow">if</span>(!Strm.is_open())
<a name="l00117"></a>00117         {
<a name="l00118"></a>00118                 cerr&lt;&lt;<span class="stringliteral">&quot;Nie mozna otworzyc potoku&quot;</span>&lt;&lt;endl;
<a name="l00119"></a>00119                 <span class="keywordflow">return</span> 1;
<a name="l00120"></a>00120         }
<a name="l00121"></a>00121 
<a name="l00122"></a>00122         Strm&lt;&lt;<span class="stringliteral">&quot;set trange [0:&quot;</span>&lt;&lt;SceneSize*SquareLength&lt;&lt;<span class="stringliteral">&quot;]&quot;</span>&lt;&lt;endl;
<a name="l00123"></a>00123         Strm&lt;&lt;<span class="stringliteral">&quot;set xrange [0:&quot;</span>&lt;&lt;SceneSize*SquareLength&lt;&lt;<span class="stringliteral">&quot;]&quot;</span>&lt;&lt;endl;
<a name="l00124"></a>00124         Strm&lt;&lt;<span class="stringliteral">&quot;set yrange [0:&quot;</span>&lt;&lt;SceneSize*SquareLength&lt;&lt;<span class="stringliteral">&quot;]&quot;</span>&lt;&lt;endl;
<a name="l00125"></a>00125         Strm&lt;&lt;<span class="stringliteral">&quot;set nokey&quot;</span>&lt;&lt;endl;
<a name="l00126"></a>00126         Strm&lt;&lt;<span class="stringliteral">&quot;set multiplot&quot;</span>&lt;&lt;endl;
<a name="l00127"></a>00127         <span class="comment">//Strm&lt;&lt;&quot;set term x11&quot;&lt;&lt;endl;</span>
<a name="l00128"></a>00128         Strm&lt;&lt;<span class="stringliteral">&quot;plot \&quot;&quot;</span>&lt;&lt;<a class="code" href="Agent_8hh.html#a4905f5e9a8eeb48ce583354c1d0c7a9f" title="komunikacji z Gnuplotem">PLOTDIR</a>&lt;&lt;<span class="stringliteral">&quot;Agent&quot;</span>&lt;&lt;AgentID&lt;&lt;<span class="stringliteral">&quot;.dat\&quot; using 1:2 with points&quot;</span>&lt;&lt;endl&lt;&lt;endl;
<a name="l00129"></a>00129         <span class="comment">//SavePlot(Strm,&quot;Scene&quot;,eps,1);</span>
<a name="l00130"></a>00130         <span class="comment">//Rysowanie kwadratow (siatki)</span>
<a name="l00131"></a>00131         Strm&lt;&lt;<span class="stringliteral">&quot;set parametric&quot;</span>&lt;&lt;endl;
<a name="l00132"></a>00132 
<a name="l00133"></a>00133         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=1;i&lt;=SceneSize;i++){
<a name="l00134"></a>00134         Strm&lt;&lt;<span class="stringliteral">&quot;const=&quot;</span>&lt;&lt;SquareLength*i&lt;&lt;endl;
<a name="l00135"></a>00135         Strm&lt;&lt;<span class="stringliteral">&quot;plot const,t&quot;</span>&lt;&lt;endl;
<a name="l00136"></a>00136         }
<a name="l00137"></a>00137         Strm&lt;&lt;<span class="stringliteral">&quot;unset parametric&quot;</span>&lt;&lt;endl;
<a name="l00138"></a>00138         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=1;i&lt;=SceneSize;i++){
<a name="l00139"></a>00139         Strm&lt;&lt;<span class="stringliteral">&quot;const=&quot;</span>&lt;&lt;SquareLength*i&lt;&lt;endl;
<a name="l00140"></a>00140         Strm&lt;&lt;<span class="stringliteral">&quot;plot const&quot;</span>&lt;&lt;endl;
<a name="l00141"></a>00141         }
<a name="l00142"></a>00142         Strm&lt;&lt;<span class="stringliteral">&quot;set nomultiplot&quot;</span>&lt;&lt;endl;
<a name="l00143"></a>00143         Strm.close();
<a name="l00144"></a>00144 
<a name="l00145"></a>00145         <span class="keywordflow">return</span> 0;
<a name="l00146"></a>00146 
<a name="l00147"></a>00147 }
<a name="l00148"></a>00148 
<a name="l00149"></a>00149 
<a name="l00166"></a><a class="code" href="GnuplotInc_8hh.html#a561196655bce7044165f5d05d38b3188">00166</a> <span class="keywordtype">int</span> <a class="code" href="GnuplotInc_8cpp.html#a561196655bce7044165f5d05d38b3188" title="Funkcja wyswietla dane zawarte w tablicy T w formie wykresu slupkowego.">BarPlot</a>(<span class="keywordtype">double</span> **T,<span class="keywordtype">int</span> n, <span class="keywordtype">int</span> m,<span class="keywordtype">int</span> winid, <a class="code" href="GnuplotInc_8hh.html#a2c794c5c13ab4dd7e65bad031dbe41c3">FileType</a> ext)
<a name="l00167"></a>00167 {
<a name="l00168"></a>00168         ofstream Strm;
<a name="l00169"></a>00169         <span class="keywordtype">char</span> dir[50]=PLOTDIR;
<a name="l00170"></a>00170         <span class="keywordtype">char</span> wid[4];
<a name="l00171"></a>00171         strcat(dir,<span class="stringliteral">&quot;barplot&quot;</span>);
<a name="l00172"></a>00172         sprintf(wid,<span class="stringliteral">&quot;%d&quot;</span>,winid);
<a name="l00173"></a>00173         strcat(dir,wid);
<a name="l00174"></a>00174         strcat(dir,<span class="stringliteral">&quot;.dat&quot;</span>);
<a name="l00175"></a>00175         Strm.open(dir);
<a name="l00176"></a>00176         <span class="keywordflow">if</span>(!Strm.is_open())
<a name="l00177"></a>00177         {
<a name="l00178"></a>00178                 cerr&lt;&lt;<span class="stringliteral">&quot;Nie mozna otworzyc pliku&quot;</span>&lt;&lt;endl;
<a name="l00179"></a>00179                 <span class="keywordflow">return</span> 1;
<a name="l00180"></a>00180         }
<a name="l00181"></a>00181         Strm&lt;&lt;<span class="stringliteral">&quot;0&quot;</span>&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;<span class="stringliteral">&quot;0&quot;</span>&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;<span class="stringliteral">&quot;0&quot;</span>&lt;&lt;endl;
<a name="l00182"></a>00182         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0;j&lt;m;j++)
<a name="l00183"></a>00183         {
<a name="l00184"></a>00184 
<a name="l00185"></a>00185                 Strm&lt;&lt;<span class="stringliteral">&quot;0&quot;</span>&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;j&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;<span class="stringliteral">&quot;0&quot;</span>&lt;&lt;endl;
<a name="l00186"></a>00186                 Strm&lt;&lt;<span class="stringliteral">&quot;0&quot;</span>&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;j+1.0&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;<span class="stringliteral">&quot;0&quot;</span>&lt;&lt;endl;
<a name="l00187"></a>00187 
<a name="l00188"></a>00188         }
<a name="l00189"></a>00189         Strm&lt;&lt;<span class="stringliteral">&quot;0&quot;</span>&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;m&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;<span class="stringliteral">&quot;0&quot;</span>&lt;&lt;endl;
<a name="l00190"></a>00190         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i&lt;n;i++)
<a name="l00191"></a>00191         {
<a name="l00192"></a>00192 
<a name="l00193"></a>00193                 Strm&lt;&lt;endl;
<a name="l00194"></a>00194                 Strm&lt;&lt;i&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;<span class="stringliteral">&quot;0&quot;</span>&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;<span class="stringliteral">&quot;0&quot;</span>&lt;&lt;endl;
<a name="l00195"></a>00195                 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0;j&lt;m;j++)
<a name="l00196"></a>00196                 {
<a name="l00197"></a>00197 
<a name="l00198"></a>00198                         Strm&lt;&lt;i&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;j&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;T[i][j]&lt;&lt;endl;
<a name="l00199"></a>00199                         Strm&lt;&lt;i&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;j+1.0&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;T[i][j]&lt;&lt;endl;
<a name="l00200"></a>00200 
<a name="l00201"></a>00201                 }
<a name="l00202"></a>00202                 Strm&lt;&lt;i&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;m&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;<span class="stringliteral">&quot;0&quot;</span>&lt;&lt;endl;
<a name="l00203"></a>00203                 Strm&lt;&lt;endl;
<a name="l00204"></a>00204                 Strm&lt;&lt;i+1&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;<span class="stringliteral">&quot;0&quot;</span>&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;<span class="stringliteral">&quot;0&quot;</span>&lt;&lt;endl;
<a name="l00205"></a>00205                 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0;j&lt;m;j++)
<a name="l00206"></a>00206                 {
<a name="l00207"></a>00207 
<a name="l00208"></a>00208                         Strm&lt;&lt;i+1.0&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;j&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;T[i][j]&lt;&lt;endl;
<a name="l00209"></a>00209                         Strm&lt;&lt;i+1.0&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;j+1.0&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;T[i][j]&lt;&lt;endl;
<a name="l00210"></a>00210 
<a name="l00211"></a>00211                 }
<a name="l00212"></a>00212                 Strm&lt;&lt;i+1&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;m&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;<span class="stringliteral">&quot;0&quot;</span>&lt;&lt;endl;
<a name="l00213"></a>00213 
<a name="l00214"></a>00214         }
<a name="l00215"></a>00215         Strm&lt;&lt;endl;
<a name="l00216"></a>00216         Strm&lt;&lt;n&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;<span class="stringliteral">&quot;0&quot;</span>&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;<span class="stringliteral">&quot;0&quot;</span>&lt;&lt;endl;
<a name="l00217"></a>00217         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0;j&lt;m;j++)
<a name="l00218"></a>00218         {
<a name="l00219"></a>00219 
<a name="l00220"></a>00220                 Strm&lt;&lt;n&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;j&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;<span class="stringliteral">&quot;0&quot;</span>&lt;&lt;endl;
<a name="l00221"></a>00221                 Strm&lt;&lt;n&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;j+1.0&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;<span class="stringliteral">&quot;0&quot;</span>&lt;&lt;endl;
<a name="l00222"></a>00222 
<a name="l00223"></a>00223         }
<a name="l00224"></a>00224         Strm&lt;&lt;n&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;m&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;<span class="stringliteral">&quot;0&quot;</span>&lt;&lt;endl;
<a name="l00225"></a>00225 
<a name="l00226"></a>00226 
<a name="l00227"></a>00227         Strm.close();
<a name="l00228"></a>00228 
<a name="l00229"></a>00229         Strm.open(<a class="code" href="GnuplotInc_8hh.html#a3ec677682fff5b0d42b967a6f62a4f90">FIFO_FILE</a>);
<a name="l00230"></a>00230         <span class="keywordflow">if</span>(!Strm.is_open())
<a name="l00231"></a>00231         {
<a name="l00232"></a>00232                 cerr&lt;&lt;<span class="stringliteral">&quot;Nie mozna otworzyc potoku&quot;</span>&lt;&lt;endl;
<a name="l00233"></a>00233                 <span class="keywordflow">return</span> 1;
<a name="l00234"></a>00234         }
<a name="l00235"></a>00235         Strm&lt;&lt;<span class="stringliteral">&quot;set term x11 &quot;</span>&lt;&lt;winid&lt;&lt;endl;
<a name="l00236"></a>00236         Strm&lt;&lt;<span class="stringliteral">&quot;set hidden3d&quot;</span>&lt;&lt;endl;
<a name="l00237"></a>00237         Strm&lt;&lt;<span class="stringliteral">&quot;set pm3d&quot;</span>&lt;&lt;endl;
<a name="l00238"></a>00238         Strm&lt;&lt;<span class="stringliteral">&quot;splot \&quot;&quot;</span>&lt;&lt;<a class="code" href="Agent_8hh.html#a4905f5e9a8eeb48ce583354c1d0c7a9f" title="komunikacji z Gnuplotem">PLOTDIR</a>&lt;&lt;<span class="stringliteral">&quot;barplot&quot;</span>&lt;&lt;winid&lt;&lt;<span class="stringliteral">&quot;.dat\&quot; with pm3d&quot;</span>&lt;&lt;endl&lt;&lt;endl;
<a name="l00239"></a>00239         <a class="code" href="GnuplotInc_8cpp.html#a07bd2e7a5945dc93fe3114d62e8040f7" title="Procedura zapisuje wyrysowany wykres do pliku o podanym rozszerzeniu.">SavePlot</a>(Strm,<span class="stringliteral">&quot;BarPlot&quot;</span>,ext,winid);
<a name="l00240"></a>00240         Strm.close();
<a name="l00241"></a>00241 
<a name="l00242"></a>00242         <span class="keywordflow">return</span> 0;
<a name="l00243"></a>00243 }
<a name="l00244"></a>00244 
<a name="l00267"></a><a class="code" href="GnuplotInc_8hh.html#a60ad3ed0cfef98900830ca6197e33cb2">00267</a> <span class="keywordtype">int</span> <a class="code" href="GnuplotInc_8cpp.html#a60ad3ed0cfef98900830ca6197e33cb2" title="Funkcja wyswietla dane zawarte w tablicy T w formie trojwymiarowej.">ColMapPlot</a>(<span class="keywordtype">double</span> **T,<span class="keywordtype">int</span> n, <span class="keywordtype">int</span> m,<span class="keywordtype">double</span> pa,<span class="keywordtype">double</span> pb,<span class="keywordtype">double</span> ka,
<a name="l00268"></a>00268                 <span class="keywordtype">double</span> kb, <span class="keywordtype">int</span> winid, <a class="code" href="GnuplotInc_8hh.html#a2c794c5c13ab4dd7e65bad031dbe41c3">FileType</a> ext)
<a name="l00269"></a>00269 {
<a name="l00270"></a>00270         ofstream Strm;
<a name="l00271"></a>00271         <span class="keywordtype">char</span> dir[50]=PLOTDIR;
<a name="l00272"></a>00272         <span class="keywordtype">char</span> wid[4];
<a name="l00273"></a>00273         strcat(dir,<span class="stringliteral">&quot;colmapplot&quot;</span>);
<a name="l00274"></a>00274         sprintf(wid,<span class="stringliteral">&quot;%d&quot;</span>,winid);
<a name="l00275"></a>00275         strcat(dir,wid);
<a name="l00276"></a>00276         strcat(dir,<span class="stringliteral">&quot;.dat&quot;</span>);
<a name="l00277"></a>00277 
<a name="l00278"></a>00278         <span class="keywordtype">double</span> a=pa,b;
<a name="l00279"></a>00279         Strm.open(dir);
<a name="l00280"></a>00280         <span class="keywordflow">if</span>(!Strm.is_open())
<a name="l00281"></a>00281         {
<a name="l00282"></a>00282                 cerr&lt;&lt;<span class="stringliteral">&quot;Nie mozna otworzyc pliku&quot;</span>&lt;&lt;endl;
<a name="l00283"></a>00283                 <span class="keywordflow">return</span> 1;
<a name="l00284"></a>00284         }
<a name="l00285"></a>00285 
<a name="l00286"></a>00286         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i&lt;n;i++)
<a name="l00287"></a>00287         {
<a name="l00288"></a>00288 
<a name="l00289"></a>00289                 b=pb;
<a name="l00290"></a>00290                 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0;j&lt;m;j++)
<a name="l00291"></a>00291                 {
<a name="l00292"></a>00292 
<a name="l00293"></a>00293                         Strm&lt;&lt;a&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;b&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;T[i][j]&lt;&lt;endl;
<a name="l00294"></a>00294                         b+=(kb-pb)/(<span class="keywordtype">double</span>)m;
<a name="l00295"></a>00295                 }
<a name="l00296"></a>00296                 Strm&lt;&lt;endl;
<a name="l00297"></a>00297                 a+=(ka-pa)/(<span class="keywordtype">double</span>)n;
<a name="l00298"></a>00298         }
<a name="l00299"></a>00299 
<a name="l00300"></a>00300         Strm.close();
<a name="l00301"></a>00301 
<a name="l00302"></a>00302         Strm.open(<a class="code" href="GnuplotInc_8hh.html#a3ec677682fff5b0d42b967a6f62a4f90">FIFO_FILE</a>);
<a name="l00303"></a>00303         <span class="keywordflow">if</span>(!Strm.is_open())
<a name="l00304"></a>00304         {
<a name="l00305"></a>00305                 cerr&lt;&lt;<span class="stringliteral">&quot;Nie mozna otworzyc potoku&quot;</span>&lt;&lt;endl;
<a name="l00306"></a>00306                 <span class="keywordflow">return</span> 1;
<a name="l00307"></a>00307         }
<a name="l00308"></a>00308         Strm&lt;&lt;<span class="stringliteral">&quot;set term x11 &quot;</span>&lt;&lt;winid&lt;&lt;endl;
<a name="l00309"></a>00309         Strm&lt;&lt;<span class="stringliteral">&quot;set ticslevel 0&quot;</span>&lt;&lt;endl;
<a name="l00310"></a>00310         Strm&lt;&lt;<span class="stringliteral">&quot;set hidden3d&quot;</span>&lt;&lt;endl;
<a name="l00311"></a>00311         Strm&lt;&lt;<span class="stringliteral">&quot;set pm3d&quot;</span>&lt;&lt;endl;
<a name="l00312"></a>00312 
<a name="l00313"></a>00313 
<a name="l00314"></a>00314 
<a name="l00315"></a>00315         Strm&lt;&lt;<span class="stringliteral">&quot;splot \&quot;&quot;</span>&lt;&lt;<a class="code" href="Agent_8hh.html#a4905f5e9a8eeb48ce583354c1d0c7a9f" title="komunikacji z Gnuplotem">PLOTDIR</a>&lt;&lt;<span class="stringliteral">&quot;colmapplot&quot;</span>&lt;&lt;winid&lt;&lt;<span class="stringliteral">&quot;.dat\&quot; using 1:2:3 with pm3d&quot;</span>&lt;&lt;endl&lt;&lt;endl;
<a name="l00316"></a>00316         <a class="code" href="GnuplotInc_8cpp.html#a07bd2e7a5945dc93fe3114d62e8040f7" title="Procedura zapisuje wyrysowany wykres do pliku o podanym rozszerzeniu.">SavePlot</a>(Strm,<span class="stringliteral">&quot;ColMap&quot;</span>,ext,winid);
<a name="l00317"></a>00317         Strm.close();
<a name="l00318"></a>00318 
<a name="l00319"></a>00319         <span class="keywordflow">return</span> 0;
<a name="l00320"></a>00320 }
<a name="l00321"></a>00321 
<a name="l00343"></a><a class="code" href="GnuplotInc_8hh.html#a40b05327fdd4cc6c39c5fc29b82c2b08">00343</a> <span class="keywordtype">int</span> <a class="code" href="GnuplotInc_8cpp.html#a40b05327fdd4cc6c39c5fc29b82c2b08" title="Funkcja wyswietla dane zawarte w tablicach a i b w odniesieniu do wartosci ref w formie wykresu 2d...">PerformPlot</a>(<span class="keywordtype">int</span> *a,<span class="keywordtype">int</span> *b, <span class="keywordtype">int</span> ra,<span class="keywordtype">int</span> rb,<span class="keywordtype">int</span> ref,<span class="keywordtype">int</span> ref2,<span class="keywordtype">int</span> winid, <a class="code" href="GnuplotInc_8hh.html#a2c794c5c13ab4dd7e65bad031dbe41c3">FileType</a> ext)
<a name="l00344"></a>00344 {
<a name="l00345"></a>00345         ofstream Strm;
<a name="l00346"></a>00346         <span class="keywordtype">int</span> r;
<a name="l00347"></a>00347         <span class="keywordtype">char</span> dir[50]=PLOTDIR;
<a name="l00348"></a>00348         <span class="keywordtype">char</span> wid[4];
<a name="l00349"></a>00349         strcat(dir,<span class="stringliteral">&quot;performplot&quot;</span>);
<a name="l00350"></a>00350         sprintf(wid,<span class="stringliteral">&quot;%d&quot;</span>,winid);
<a name="l00351"></a>00351         strcat(dir,wid);
<a name="l00352"></a>00352         strcat(dir,<span class="stringliteral">&quot;.dat&quot;</span>);
<a name="l00353"></a>00353         Strm.open(dir);
<a name="l00354"></a>00354         <span class="keywordflow">if</span>(!Strm.is_open())
<a name="l00355"></a>00355         {
<a name="l00356"></a>00356                 cerr&lt;&lt;<span class="stringliteral">&quot;PerformPlot:Nie mozna otworzyc pliku&quot;</span>&lt;&lt;endl;
<a name="l00357"></a>00357                 <span class="keywordflow">return</span> 1;
<a name="l00358"></a>00358         }
<a name="l00359"></a>00359         <span class="keywordflow">if</span>(ra&gt;=rb)
<a name="l00360"></a>00360                 r=ra;
<a name="l00361"></a>00361         <span class="keywordflow">else</span>
<a name="l00362"></a>00362                 r=rb;
<a name="l00363"></a>00363         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i&lt;r;i++)
<a name="l00364"></a>00364         {
<a name="l00365"></a>00365                 <span class="keywordflow">if</span>((r&lt;=ra)&amp;&amp;(r&lt;=rb))
<a name="l00366"></a>00366                         Strm&lt;&lt;i&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;a[i]&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;b[i]&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;ref&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;ref2&lt;&lt;endl;
<a name="l00367"></a>00367                 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(r&lt;=ra)
<a name="l00368"></a>00368                         Strm&lt;&lt;i&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;a[i]&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;b[rb-1]&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;ref&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;ref2&lt;&lt;endl;
<a name="l00369"></a>00369                 <span class="keywordflow">else</span>
<a name="l00370"></a>00370                         Strm&lt;&lt;i&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;a[ra-1]&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;b[i]&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;ref&lt;&lt;<span class="stringliteral">&quot; &quot;</span>&lt;&lt;ref2&lt;&lt;endl;
<a name="l00371"></a>00371 
<a name="l00372"></a>00372         }
<a name="l00373"></a>00373         Strm.close();
<a name="l00374"></a>00374 
<a name="l00375"></a>00375         Strm.open(<a class="code" href="GnuplotInc_8hh.html#a3ec677682fff5b0d42b967a6f62a4f90">FIFO_FILE</a>);
<a name="l00376"></a>00376         <span class="keywordflow">if</span>(!Strm.is_open())
<a name="l00377"></a>00377         {
<a name="l00378"></a>00378                 cerr&lt;&lt;<span class="stringliteral">&quot;Nie mozna otworzyc potoku&quot;</span>&lt;&lt;endl;
<a name="l00379"></a>00379                 <span class="keywordflow">return</span> 1;
<a name="l00380"></a>00380         }
<a name="l00381"></a>00381 
<a name="l00382"></a>00382 
<a name="l00383"></a>00383 
<a name="l00384"></a>00384         Strm&lt;&lt;<span class="stringliteral">&quot;set term x11 &quot;</span>&lt;&lt;winid&lt;&lt;endl;
<a name="l00385"></a>00385         <span class="comment">//Strm&lt;&lt;&quot;unset ticslevel 0&quot;&lt;&lt;endl;</span>
<a name="l00386"></a>00386         Strm&lt;&lt;<span class="stringliteral">&quot;unset hidden3d&quot;</span>&lt;&lt;endl;
<a name="l00387"></a>00387         Strm&lt;&lt;<span class="stringliteral">&quot;unset pm3d&quot;</span>&lt;&lt;endl;
<a name="l00388"></a>00388 
<a name="l00389"></a>00389         Strm&lt;&lt;<span class="stringliteral">&quot;set grid&quot;</span>&lt;&lt;endl;
<a name="l00390"></a>00390         Strm&lt;&lt;<span class="stringliteral">&quot;plot \&quot;&quot;</span>&lt;&lt;<a class="code" href="Agent_8hh.html#a4905f5e9a8eeb48ce583354c1d0c7a9f" title="komunikacji z Gnuplotem">PLOTDIR</a>&lt;&lt;<span class="stringliteral">&quot;performplot&quot;</span>&lt;&lt;winid&lt;&lt;<span class="stringliteral">&quot;.dat\&quot; using 1:2 with lines,  &quot;</span>;
<a name="l00391"></a>00391         Strm&lt;&lt;<span class="stringliteral">&quot;\&quot;&quot;</span>&lt;&lt;<a class="code" href="Agent_8hh.html#a4905f5e9a8eeb48ce583354c1d0c7a9f" title="komunikacji z Gnuplotem">PLOTDIR</a>&lt;&lt;<span class="stringliteral">&quot;performplot&quot;</span>&lt;&lt;winid&lt;&lt;<span class="stringliteral">&quot;.dat\&quot; using 1:3 with lines,  &quot;</span>;
<a name="l00392"></a>00392         Strm&lt;&lt;<span class="stringliteral">&quot;\&quot;&quot;</span>&lt;&lt;<a class="code" href="Agent_8hh.html#a4905f5e9a8eeb48ce583354c1d0c7a9f" title="komunikacji z Gnuplotem">PLOTDIR</a>&lt;&lt;<span class="stringliteral">&quot;performplot&quot;</span>&lt;&lt;winid&lt;&lt;<span class="stringliteral">&quot;.dat\&quot; using 1:4 with lines,  &quot;</span>;
<a name="l00393"></a>00393         Strm&lt;&lt;<span class="stringliteral">&quot;\&quot;&quot;</span>&lt;&lt;<a class="code" href="Agent_8hh.html#a4905f5e9a8eeb48ce583354c1d0c7a9f" title="komunikacji z Gnuplotem">PLOTDIR</a>&lt;&lt;<span class="stringliteral">&quot;performplot&quot;</span>&lt;&lt;winid&lt;&lt;<span class="stringliteral">&quot;.dat\&quot; using 1:5 with lines  &quot;</span>&lt;&lt;endl&lt;&lt;endl;
<a name="l00394"></a>00394         <a class="code" href="GnuplotInc_8cpp.html#a07bd2e7a5945dc93fe3114d62e8040f7" title="Procedura zapisuje wyrysowany wykres do pliku o podanym rozszerzeniu.">SavePlot</a>(Strm,<span class="stringliteral">&quot;sym&quot;</span>,ext,winid);
<a name="l00395"></a>00395         Strm.close();
<a name="l00396"></a>00396         <span class="keywordflow">return</span> 0;
<a name="l00397"></a>00397 }
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Wygenerowano Thu Dec 15 2011 16:57:10 dla Rozproszony_system_koordynacji_agentow_mobilnych programem&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
</body>
</html>
